<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    164. Maximum Gap
   </h1>
   <p>
    Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
   </p>
   <p>
    Return 0 if the array contains less than 2 elements.
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> [3,6,9,1]
<strong>Output:</strong> 3
<strong>Explanation:</strong> The sorted form of the array is [1,3,6,9], either
&nbsp;            (3,6) or (6,9) has the maximum difference 3.</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> [10]
<strong>Output:</strong> 0
<strong>Explanation:</strong> The array contains less than 2 elements, therefore return 0.</pre>
   <p>
    <b>
     Note:
    </b>
   </p>
   <ul>
    <li>
     You may assume all elements in the array are non-negative integers and fit in the 32-bit signed integer range.
    </li>
    <li>
     Try to solve it in linear time/space.
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    164. 最大间距
   </h1>
   <p>
    给定一个无序的数组，找出数组在排序之后，相邻元素之间最大的差值。
   </p>
   <p>
    如果数组元素个数小于 2，则返回 0。
   </p>
   <p>
    <strong>
     示例&nbsp;1:
    </strong>
   </p>
   <pre><strong>输入:</strong> [3,6,9,1]
<strong>输出:</strong> 3
<strong>解释:</strong> 排序后的数组是 [1,3,6,9]<strong><em>, </em></strong>其中相邻元素 (3,6) 和 (6,9) 之间都存在最大差值 3。</pre>
   <p>
    <strong>
     示例&nbsp;2:
    </strong>
   </p>
   <pre><strong>输入:</strong> [10]
<strong>输出:</strong> 0
<strong>解释:</strong> 数组元素个数小于 2，因此返回 0。</pre>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ul>
    <li>
     你可以假设数组中所有元素都是非负整数，且数值在 32 位有符号整数范围内。
    </li>
    <li>
     请尝试在线性时间复杂度和空间复杂度的条件下解决此问题。
    </li>
   </ul>
  </div>
 </body>
</html>